<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>天城用工</title>
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <style>
        html,
        body {
            margin: 0;
            padding: 0;
        }

        #app {
            height: 100vh;
            background: url('./image/img/qishi_bg.png') no-repeat center center;
            background-size: cover;
            color: #fff;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 8rem 0 2.5rem 0;
        }

        .logo {
            width: 6rem;
            height: 6rem;
            display: block;
            margin: 0 auto;
        }

        .biaoyu {
            height: 5rem;
            display: block;
            margin: 0 auto;
        }

        .btn {
            width: 5rem;
            height: 1.6rem;
            background: #0689FB;
            color: #fff;
            line-height: 1.6rem;
            border-radius: 0.3rem;
            text-align: center;
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <!-- <div id="app">
        <img class="logo" src="./image/icon/logo1.png" alt="">
        <img class="biaoyu" src="./image/my/biaoyu.png" alt="">
        <div class="btn" onclick="openFrame()">立即体验</div>
    </div> -->
</body>

</html>
<script src="./script/api.js"></script>
<script src='./script/common/jquery-3.3.1.min.js'></script>
<script src='./script/common/common.js'></script>
<script src='./script/common/config.js'></script>
<script type="text/javascript">
    apiready = function() {
        // 设置沉浸式和透明背景
        set_BarStyle("light", "rgba(0,0,0,0)");

        //获取用户位置
        getUserLocation();
    }

    //获取用户位置
    function getUserLocation() {
        //获取用户坐标,api自带的是谷歌的,使用国货快！！！
        if (api.systemType == 'ios') {
            //不兼容ios 随便给个经纬度用
            var lon = 39.9144123454;
            var lat = 116.4044314011;
            getRegion(lon, lat);
        } else {
            //获取用户实际坐标信息
            var aMap = api.require('aMap');
            aMap.getLocation(function(ret, err) {
                if (ret.status) {
                    getRegion(ret.lon, ret.lat)
                }
            });
        }
    }

    //获取城市区域
    function getRegion(lon, lat) {
      console.log(lon);
      console.log(lat);
        _ajax(Config.api.HomeGetRegion, {
            longitude: lon,
            latitude: lat
        }, function(res) {
            if (res.code === 200) {
                res.data.lon = lon;
                res.data.lat = lat;
                set_local('user_region', res.data);
                openFrame();
            }
        })
    }

    function openFrame() {
        api.openWin({
            name: 'main',
            url: './html/main.html',
            slidBackEnabled: false
        });
    }
</script>
